using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._Generalization
{
    /// <summary>
    /// <para>Aggregate</para>
    /// <para>Generates a reduced-resolution version of a raster. Each output cell contains the Sum, Minimum, Maximum, Mean, or Median of the input cells that are encompassed by the extent of that cell.</para>
    /// <para>生成栅格的低分辨率版本。每个输出像元都包含输入像元的范围所包含的输入像元的总和、最小值、最大值、平均值或中位数。</para>
    /// </summary>    
    [DisplayName("Aggregate")]
    public class Aggregate : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Aggregate()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster to aggregate.</para>
        ///   <para>It can be of integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要聚合的输入栅格。</para>
        ///   <para>它可以是整数或浮点类型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output aggregated raster.</para>
        ///   <para>It is a reduced-resolution version of the input raster.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出聚合栅格。</para>
        ///   <para>它是输入栅格的低分辨率版本。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_cell_factor">
        /// <para>Cell factor</para>
        /// <para><xdoc>
        ///   <para>The factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster.</para>
        ///   <para>For example, a cell factor value of three would result in an output cell size three times larger than that of the input raster.</para>
        ///   <para>The value must be an integer greater than 1.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将输入栅格的像元大小相乘以获得输出栅格所需分辨率的因子。</para>
        ///   <para>例如，像元因子值为 3 将导致输出像元大小是输入栅格的三倍。</para>
        ///   <para>该值必须是大于 1 的整数。</para>
        /// </xdoc></para>
        /// </param>
        public Aggregate(object _in_raster, object _out_raster, long? _cell_factor)
        {
            this._in_raster = _in_raster;
            this._out_raster = _out_raster;
            this._cell_factor = _cell_factor;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Aggregate";

        public override string CallName => "sa.Aggregate";

        public override List<string> AcceptEnvironments => ["autoCommit", "cellSize", "cellSizeProjectionMethod", "compression", "configKeyword", "extent", "geographicTransformations", "mask", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _out_raster, _cell_factor, _aggregation_type.GetGPValue(), _extent_handling.GetGPValue(), _ignore_nodata.GetGPValue()];

        /// <summary>
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster to aggregate.</para>
        ///   <para>It can be of integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要聚合的输入栅格。</para>
        ///   <para>它可以是整数或浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output aggregated raster.</para>
        ///   <para>It is a reduced-resolution version of the input raster.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出聚合栅格。</para>
        ///   <para>它是输入栅格的低分辨率版本。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Cell factor</para>
        /// <para><xdoc>
        ///   <para>The factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster.</para>
        ///   <para>For example, a cell factor value of three would result in an output cell size three times larger than that of the input raster.</para>
        ///   <para>The value must be an integer greater than 1.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将输入栅格的像元大小相乘以获得输出栅格所需分辨率的因子。</para>
        ///   <para>例如，像元因子值为 3 将导致输出像元大小是输入栅格的三倍。</para>
        ///   <para>该值必须是大于 1 的整数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cell factor")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public long? _cell_factor { get; set; }


        /// <summary>
        /// <para>Aggregation technique</para>
        /// <para><xdoc>
        ///   <para>Establishes how the value for each output cell will be determined.</para>
        ///   <para>The values of the input cells encompassed by the coarser output cell are aggregated by one of the following statistics:</para>
        ///   <bulletList>
        ///     <bullet_item>Sum—The sum (total) of the input cell values.This is the default.</bullet_item><para/>
        ///     <bullet_item>Maximum—The largest value of the input cells.</bullet_item><para/>
        ///     <bullet_item>Mean—The average value of the input cells.</bullet_item><para/>
        ///     <bullet_item>Median—The median value of the input cells.</bullet_item><para/>
        ///     <bullet_item>Minimum—The smallest value of the input cells.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>确定如何确定每个输出单元格的值。</para>
        ///   <para>较粗的输出像元所包含的输入像元的值由以下统计量之一聚合：</para>
        ///   <bulletList>
        ///     <bullet_item>Sum - 输入像元值的总和（总计）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>最大值 - 输入像元的最大值。</bullet_item><para/>
        ///     <bullet_item>平均值 - 输入像元的平均值。</bullet_item><para/>
        ///     <bullet_item>中位数 - 输入像元的中值。</bullet_item><para/>
        ///     <bullet_item>最小值 - 输入像元的最小值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Aggregation technique")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _aggregation_type_value _aggregation_type { get; set; } = _aggregation_type_value._SUM;

        public enum _aggregation_type_value
        {
            /// <summary>
            /// <para>Sum</para>
            /// <para>Sum—The sum (total) of the input cell values.This is the default.</para>
            /// <para>Sum - 输入像元值的总和（总计）。这是默认设置。</para>
            /// </summary>
            [Description("Sum")]
            [GPEnumValue("SUM")]
            _SUM,

            /// <summary>
            /// <para>Maximum</para>
            /// <para>Maximum—The largest value of the input cells.</para>
            /// <para>最大值 - 输入像元的最大值。</para>
            /// </summary>
            [Description("Maximum")]
            [GPEnumValue("MAXIMUM")]
            _MAXIMUM,

            /// <summary>
            /// <para>Mean</para>
            /// <para>Mean—The average value of the input cells.</para>
            /// <para>平均值 - 输入像元的平均值。</para>
            /// </summary>
            [Description("Mean")]
            [GPEnumValue("MEAN")]
            _MEAN,

            /// <summary>
            /// <para>Median</para>
            /// <para>Median—The median value of the input cells.</para>
            /// <para>中位数 - 输入像元的中值。</para>
            /// </summary>
            [Description("Median")]
            [GPEnumValue("MEDIAN")]
            _MEDIAN,

            /// <summary>
            /// <para>Minimum</para>
            /// <para>Minimum—The smallest value of the input cells.</para>
            /// <para>最小值 - 输入像元的最小值。</para>
            /// </summary>
            [Description("Minimum")]
            [GPEnumValue("MINIMUM")]
            _MINIMUM,

        }

        /// <summary>
        /// <para>Expand extent if needed</para>
        /// <para><xdoc>
        ///   <para>Defines how to handle the boundaries of the input raster when its rows or columns are not a multiple of the cell factor.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Expands the top or right boundaries of the input raster so the total number of cells in a row or column is a multiple of the cell factor. Those expanded cells are given a value of NoData when put into the calculation.
        ///     <para>With this option, the output raster can cover a larger spatial extent than the input raster.</para>
        ///     <para>This is the default.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Unchecked—Reduces the number of rows or columns in the output raster. This will truncate the remaining cells on the top or right boundaries of the input raster, making the number of rows or columns in the input raster a multiple of the cell factor.
        ///     <para>With this option, the output raster can cover a smaller spatial extent than the input raster.</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   <para>If the number of rows and columns in the input raster is a multiple of the Cell factor, these keywords are not used.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义当输入栅格的行或列不是像元因子的倍数时如何处理输入栅格的边界。</para>
        ///   <bulletList>
        /// <bullet_item>选中 - 扩展输入栅格的顶部或右侧边界，使行或列中的像元总数为像元因子的倍数。当这些展开的单元格被放入计算中时，它们的值为 NoData。
        ///     <para>使用此选项时，输出栅格可以覆盖比输入栅格更大的空间范围。</para>
        ///     <para>这是默认设置。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>未选中 - 减少输出栅格中的行数或列数。这将截断输入栅格顶部或右侧边界上的剩余像元，使输入栅格中的行数或列数成为像元因子的倍数。
        ///     <para>使用此选项时，输出栅格可以覆盖的空间范围小于输入栅格。</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   <para>如果输入栅格中的行数和列数是像元因子的倍数，则不会使用这些关键字。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Expand extent if needed")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _extent_handling_value _extent_handling { get; set; } = _extent_handling_value._true;

        public enum _extent_handling_value
        {
            /// <summary>
            /// <para>EXPAND</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("EXPAND")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>TRUNCATE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TRUNCATE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Ignore NoData in calculations</para>
        /// <para><xdoc>
        ///   <para>Denotes whether NoData values are ignored by the aggregation calculation.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Specifies that if NoData values exist for any of the cells that fall within the spatial extent of a larger cell on the output raster, the NoData values will be ignored when determining the value for output cell locations. Only input cells within the extent of the output cell that have data values will be used in determining the value of the output cell.
        ///     <para>This is the default.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Unchecked—Specifies that if any cell that falls within the spatial extent of a larger cell on the output raster has a value of NoData, the value for that output cell location will be NoData.
        ///     <para>When Unchecked is used, it is implied that when cells within an aggregation contain the NoData value, there is insufficient information to perform the specified calculations necessary to determine an output value.</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>表示聚合计算是否忽略 NoData 值。</para>
        ///   <bulletList>
        /// <bullet_item>选中 - 指定如果位于输出栅格上较大像元空间范围内的任何像元存在 NoData 值，则在确定输出像元位置的值时将忽略 NoData 值。在确定输出像元的值时，将仅使用输出像元范围内具有数据值的输入像元。
        ///     <para>这是默认设置。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>未选中 - 指定如果位于输出栅格上较大像元的空间范围内的任何像元的值为 NoData，则该输出像元位置的值将为 NoData。
        ///     <para>使用“未选中”时，意味着当聚合中的单元格包含 NoData 值时，没有足够的信息来执行确定输出值所需的指定计算。</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ignore NoData in calculations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _ignore_nodata_value _ignore_nodata { get; set; } = _ignore_nodata_value._true;

        public enum _ignore_nodata_value
        {
            /// <summary>
            /// <para>DATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DATA")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NODATA")]
            [GPEnumValue("false")]
            _false,

        }

        public Aggregate SetEnv(int? autoCommit = null, object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object mask = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, mask: mask, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}